#!/bin/sh
# python wrapper trying to fix the python versioning hell
# -- pancake

PCS="${PYTHON_CONFIG}
	python2
	python25
	python2.5
	python26
	python2.6
	python27
	python2.7
	python28
	python2.8
	python"
PYCFG=""

for a in ${PCS} ; do
	$a --help >/dev/null 2>&1
	if [ $? = 0 ]; then
		PYCFG=$a
		PY3=`$a --version 2>&1 | grep 'Python 3'`
		[ -z "${PY3}" ] && break
	fi
done

[ -z "${PYCFG}" ] && exit 1
if [ "$1" = "-n" ]; then
	echo ${PYCFG}
	exit 0
fi

${PYCFG} $@ | sed -e 's/-arch [^\s]*//g' | \
	sed s,-Wstrict-prototypes,,g 2>/dev/null
